---
import Layout from "../layouts/Layout.astro";
import PageHeading from "../components/page-heading.astro";
import PostEntry from "../components/post-entry.astro";
---

<Layout>
  <PageHeading>
    <th:block slot="title" th:text="'标签：'+${tag.spec.displayName}">
    </th:block>
    <th:block slot="subtitle" th:text="${tag.postCount}+' 篇文章'"></th:block>
  </PageHeading>
  <th:block th:with="postItems=${posts.items}">
    <PostEntry />
    <div
      th:if="${posts.hasPrevious() || posts.hasNext()}"
      class="pagination flex justify-between items-center"
    >
      <a
        th:if="${posts.hasPrevious()}"
        class="btn w-20"
        role="navigation"
        th:href="@{${posts.prevUrl}}"
        title="上一页">上一页</a
      >
      <span class="text-sm" th:text="${posts.page} +'/'+ ${posts.totalPages}"
      ></span>
      <a
        th:if="${posts.hasNext()}"
        class="btn w-20"
        role="navigation"
        th:href="@{${posts.nextUrl}}"
        title="下一页">下一页</a
      >
    </div>
  </th:block>
</Layout>
